#ifndef  __msgQ__
#define __msgQ__

/***********************************************************************************************************************
 * INCLUDES
 */
#include "../config/trdp_mini_config.h"
#include "../api/trdp_mini_types.h"

#ifdef __cplusplus
extern "C" {
#endif

#define 	OS_MAX_QS       		(2)   		/*number of msg q									 */
#define 	OS_Q_FULL       		(30)
#define  	OS_POST_OPT_NONE       (0x00)        /* Post to highest priority task waiting             */
#define  	OS_POST_OPT_FRONT      (0x01)        /* Post to highest priority task waiting             */

typedef struct os_q {                   /* QUEUE CONTROL BLOCK                                         */
    struct os_q   *OSQPtr;              /* Link to next queue control block in list of free blocks     */
    void         **OSQStart;            /* Pointer to start of queue data                              */
    void         **OSQEnd;              /* Pointer to end   of queue data                              */
    void         **OSQIn;               /* Pointer to where next message will be inserted  in   the Q  */
    void         **OSQOut;              /* Pointer to where next message will be extracted from the Q  */
    INT16U         OSQSize;             /* Size of queue (maximum number of entries)                   */
    INT16U         OSQEntries;          /* Current number of entries in the queue                      */
} OS_Q;

typedef struct {
    void          *OSMsg;               /* Pointer to next message to be extracted from queue          */
    INT16U         OSNMsgs;             /* Number of messages in message queue                         */
    INT16U         OSQSize;             /* Size of message queue                                       */
} OS_Q_DATA;

void  OS_QInit (void);
void  *OSQCreate (void **start, INT16U size);
INT8U  OSQPostOpt (void *pevent, void *msg, INT8U opt);
void  *OSQAccept (void *pevent);
INT8U  OSQFlush (void *pevent);
INT8U  OSQDel (void *pevent);

#ifdef __cplusplus
}
#endif
#endif // msgQ
